C++ is a general-purpose programming language developed at Bell Labs in 1979 by Danish computer scientist Bjarne Stroustrup as an expansion of the C programming language, sometimes known as "C with Classes."
Java is a very popular and high-level platform independent programming language
Java was created in 1995 by Sun Microsystems (which is now a part of Oracle), and java run in more than 3 devices . The founder of Java is James Gosling, also known as the "Father of Java." Java is first known as oak.
but Oak was already a recognised business so James Gosling and his colleagues decided to alter the name to Java.
Difference Between Java and C++ are mention below
S.N | Basis for comparison | C++ | Java |
---|---|---|---|
1. | Platform dependency | C++ is platform Dependent | Java is platform Independent |
2. | Programming Approach | C++ uses the bottom-up approach | Java also uses the bottom-up approach |
3. | Code Execution | C++ code is executed directly | Java code is executed by the JVM. It first converted into byte code then machine code |
4. | Constructor/ Destructor | C++ supports both constructor and destructor | Java supports constructors only |
5. | Overloading | C++ support method and operator overloading. | Java support method but it does not support operator overloading. |
6. | Uses | C++ is widely used for system programming | Java is used to develop web applications, mobile applications, and windows applications |
7. | Portability | Source must be recompiled for every platform, that's why code is not portable | Java is very portable programming language. Java code can be reused i.e write once, run anywhere it give portablity you to carry the Java bytecode to any platform. |
8. | Dynamic or Static | C++ is a static programming language | Java is a dynamic programming languagee |
9. | Array Size | In C++ array should be declared with size | In Java array can be declared without declaring the size |
10. | Libraries | Predominantly low-level functionality | Massive, classes for high-level services |
11. | Memory management | In C++ memory is Accessible to programmer | In Java memory is in System controlled |
12. | Runtime error detection | In C++ runtime error detection is Programmer responsibility | In Java runtime error detection is System responsibility. Java uses exception handling to handle run time error |
13. | Supports | C++ supports Pointers, structure and Union | Java does not supports Pointers, structure and Union |
Post your comment